package org.supper.auth.feign;

import org.supper.auth.feign.hystrix.AuthServiceHystrix;
import org.supper.auth.entity.JWT;
import org.springframework.cloud.openfeign.FeignClient;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;


@FeignClient(value = "auth", fallback = AuthServiceHystrix.class)
public interface AuthServiceFeign {
    @PostMapping(value = "/oauth/token")
    JWT getToken(@RequestHeader(value = "Authorization") String authorization,
                 @RequestParam("grant_type") String grantType,
                 @RequestParam("username") String username,
                 @RequestParam("password") String password);

    @PostMapping(value = "/oauth/token")
    JWT refreshToken(@RequestHeader(value = "Authorization") String authorization,
                 @RequestParam("grant_type") String grantType,
                 @RequestParam("refresh_token") String refresh_token);


    @PostMapping(value = "/oauth/token")
    JWT getTokenByPhone(@RequestHeader(value = "Authorization") String authorization,
                        @RequestParam("grant_type") String grantType,
                        @RequestParam("mobile") String phone,
                        @RequestParam("verifyCode") String verifyCode);
}
